# requests 安装
# pip install requests -i https://mirrors.aliyun.com/pypi/simple/
# requests 快速上手
# https://requests.readthedocs.io/projects/cn/zh-cn/latest/user/quickstart.html
# requests 官方文档
# https://requests.readthedocs.io/projects/cn/zh-cn/latest/

import requests

url = 'http://www.baidu.com'

response = requests.get(url=url)

# response类型
print(type(response))

# 设置响应编码格式
response.encoding = 'utf-8'

# 以字符串的形式来返回网页的源码
# print(response.text)

# 返回一个url地址
print(response.url)

# 返回二进制的数据
print(response.content)

# 返回响应码的状态
print(response.status_code)

# 返回请求头响应
print(response.headers)
